package Y2024.M11.D19;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 25228
 * Date: 2024-11-19
 * Time: 9:55
 */
public class Main{
    public static void main(String[] args) {
        try {
            Circle c1 = new Circle();
            Circle c2 = new Circle();
            c1.setRadius(2);
            c2.setRadius(-1);
        }catch (IllegalArgumentException ex){
            System.out.println(ex);
        }
    }
}

class Circle{
    public double radius=0;
    public void setRadius(double r){
        if (r<0){
            throw new IllegalArgumentException("半径过小");
        }
        this.radius=r;
    }
}